package com.example.qzdemo11;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;

import android.Manifest;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Rect;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.UserManager;
import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.system.Os;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.Display;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.kte.interfacesettings.aidl.ITools;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import android.util.DisplayMetrics;
import android.graphics.Point;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{
    private static final String TAG = "lfy";
    private ITools myAIDLService;
    private EditText editText;
    private EditText qsItem;
    private Button btn;
    int a = 0;
    private static double mInch = 0;



    private ServiceConnection connectionService = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            Log.d(TAG," onServiceConnected.......");
            myAIDLService = ITools.Stub.asInterface(iBinder);
            if(myAIDLService !=null){
                Log.d(TAG," myAIDLService"+myAIDLService.toString()+" AIDL 连接成功");
            }else {
                Log.d(TAG,"AIDL 绑定失败...");
            }

            TextUtils.isEmpty("");
            Log.d(TAG,"AIDL 绑定成功");
            try {
//                myAIDLService.enableTp(true);
//                myAIDLService.lockNow(true);
            }catch (Exception e){
                Log.d(TAG,"AIDL 绑定失败...Error...");
            }

            Os.uname();
        }

        @Override
        public void onServiceDisconnected(ComponentName componentName) {
            Log.d(TAG,"AIDL 解除绑定...");
            myAIDLService = null;
        }
    };

    @Override
    public void onConfigurationChanged(@NonNull Configuration newConfig) {
        Log.d("lfy","111.........");
        super.onConfigurationChanged(newConfig);
        Log.d("lfy","newConfig="+newConfig.orientation);
//        Log.d("lfy","orientation="+)
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        double a = 6.140489728E9;
        String str = "6.1 GB";//浮点变量a转换为字符串str
        int idx = str.lastIndexOf(" ");//查找小数点的位置
        String strNum = str.substring(0,idx);//截取从字符串开始到小数点位置的字符串，就是整数部分
        Log.d("lfy","onCreate...strNum="+strNum);
        int index = str.lastIndexOf(".");//查找小数点的位置
        String preNum = str.substring(0,index);//截取从字符串开始到小数点位置的字符串，就是整数部分
        String realTotalRam = Float.parseFloat(preNum)+" GB";
        Log.d("lfy","onCreate...preNum="+preNum+",backNum="+realTotalRam);

//        HashMap<String,Double > example= new HashMap<String, Double>();
//        for (String name: example.keySet()){
//            String key =name.toString();
//            String value = example.get(name).toString();
//            System.out.println(key + " " + value);
//        }
        Log.d("lfy","222.........TaskId="+getTaskId());
        setContentView(R.layout.activity_main);

        editText = findViewById(R.id.item);
        qsItem = findViewById(R.id.qsItem);

        final List<ComponentName> allComponents = new ArrayList<>();
        allComponents.add(new ComponentName("cn.netin.launcher", "cn.netin.launcher.installer.InstallActivity"));
        allComponents.toArray(new ComponentName[0]);
        Log.d("lfy","allComponents..."+allComponents.size());

        DisplayMetrics dm = getResources().getDisplayMetrics();
        int screenWidth = dm.widthPixels;  // 屏幕宽度（像素）
        int screenHeight = dm.heightPixels;  // 屏幕高度（像素）
        float densityDPI = dm.densityDpi;  // 屏幕密度（0.75 / 1.0 / 1.5，小米4的是3.0）
        //int densityDpi = metric.densityDpi;  // 屏幕密度DPI（120 / 160 / 240,小米4的是480）
        //Log.d("lfy","onCreate...width="+screenWidth+",height="+screenHeight+",densityDpi="+densityDPI+"尺寸："+getScreenInch(getBaseContext()));

        Log.d("lfy","onCreate..."+connectionService);

        Intent intent = new Intent("com.kte.interfacesettings.aidl");
        intent.setPackage("com.kte.interfacesettings");
        this.getApplicationContext().bindService(intent,connectionService,Context.BIND_AUTO_CREATE);

        android.util.Log.d("lfy","onCreate....移位："+(((1 != 0) && ((18 & (1l << 1)) != 0)))+"");

        if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.O){
            String channelId="chat";
            String channelName="聊天信息";
            int importance=NotificationManager.IMPORTANCE_HIGH;
            createNotificationChannel(channelId,channelName,importance);

            channelId="subscribe";
            channelName="订阅信息";
            importance=NotificationManager.IMPORTANCE_DEFAULT;
            createNotificationChannel(channelId,channelName,importance);
        }

        MyReceiver myReceiver = new MyReceiver();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.intent.action.PTT.down");
        intentFilter.addAction("android.intent.action.PTT.up");
        intentFilter.addAction("android.intent.action.SOS.down");
        intentFilter.addAction("android.intent.action.SOS.up");
        Log.d("lfy","注册广播......");
        registerReceiver(myReceiver,intentFilter);

    }

    public double calculateDpi(int width,int height,double inch){
        double diagonal = Math.sqrt(width * width + height * height);
        return diagonal / inch;
    }

    @RequiresApi(api = Build.VERSION_CODES.O)
    public void createNotificationChannel(String channelId, String channelName, int importance){
        NotificationChannel channel=new NotificationChannel(channelId, channelName, importance);
        channel.setShowBadge(true);//没起作用，为什么？
        NotificationManager notificationManager= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.createNotificationChannel(channel);
    }

    @Override
    public void onClick(View view){
        Log.d("lfy","[MainActivity] onClick......");
        switch (view.getId()) {
            case R.id.showBack:
                try {
                    Log.d("lfy","[MainActivity] onClick......showBack......");
//                    myAIDLService.setBackVisible(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示Back成功！", Toast.LENGTH_LONG).show();
                break;
            case R.id.openDocument:
                try {
                    ComponentName cmp = new ComponentName("com.android.documentsui","com.android.documentsui.files.LauncherActivity");
                    Intent intent = new Intent();
                    intent.setComponent(cmp);
                    startActivity(intent);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开document成功！", Toast.LENGTH_LONG).show();
                break;

            case R.id.hideBack:
                try {
//                    myAIDLService.setBackVisible(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏Back成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.showHome:
                try {
//                    myAIDLService.setHomeVisible(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示Home成功", Toast.LENGTH_LONG).show();
                break;

            case R.id.hideHome:
                try {
//                    myAIDLService.setHomeVisible(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏Home成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.showRecent:
                try {
//                    myAIDLService.setRecentVisible(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示Recent成功", Toast.LENGTH_LONG).show();
                break;

            case R.id.hideRecent:
                try {
//                    myAIDLService.setRecentVisible(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏Recent成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.showNav:
                try {
//                    myAIDLService.setNavigationBarShow(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示NavigationBar成功", Toast.LENGTH_LONG).show();
                break;

            case R.id.hideNav:
                try {
//                    myAIDLService.setNavigationBarShow(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏NavigationBar成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.showDrop:
                try {
//                    myAIDLService.setStatusBarDropEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示下拉成功", Toast.LENGTH_LONG).show();
                break;

            case R.id.hideDrop:
                try {
//                    myAIDLService.setStatusBarDropEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏下拉成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.showStatusBar:
                try {
//                    myAIDLService.setStatusBarVisible(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示StatusBar成功", Toast.LENGTH_LONG).show();
                break;

            case R.id.hideStatusBar:
                try {
//                    myAIDLService.setStatusBarVisible(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏StatusBar成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setInstallNonMarketAppOpen:
                try {
//                    myAIDLService.setInstallNonMarketApp("com.jingdong.app.mall",true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开未知来源成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setInstallNonMarketAppClose:
                try {
//                    myAIDLService.setInstallNonMarketApp("com.jingdong.app.mall",false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关闭未知来源成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.closeAlarm:
                try {
//                    myAIDLService.stopCurrentAlarm();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关闭闹钟成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setAccessibility:
                try {
                    List<ComponentName> list = new ArrayList<>();
                    list.add(0,new ComponentName("com.fadi.forestautoget","com.fadi.forestautoget.service.AccessibilityServiceMonitor"));
//                    myAIDLService.setAccessibility(list);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开辅助功能成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setPersistentApp:
                try {
//                    myAIDLService.setPersistentApp("com.jingdong.app.mall",true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "保活成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getPersistentApp:
//                try {
//                    List<String> list = myAIDLService.getPersistentApp();
//                    String listStr = "";
//                    for (String str : list){
//                        listStr += str;
//                    }
//                    Log.d("lfy","getPersistentApp="+listStr);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "保活成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setHomeEnable:
                try {
//                    myAIDLService.setHomeEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用HOME成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setHomeDisable:
                try {
//                    myAIDLService.setHomeEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用HOME成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setBackEnable:
                try {
//                    myAIDLService.setBackEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用BACK成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setBackDisable:
                try {
//                    myAIDLService.setBackEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用BACK成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setRecentEnable:
                try {
//                    myAIDLService.setRecentEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用RECENT成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setRecentDisable:
                try {
//                    myAIDLService.setRecentEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用RECENT成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setPowerKeyEnable:
                try {
//                    myAIDLService.setPowerKeyEnable(true,true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用POWER键成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setPowerKeyDisable:
                try {
//                    myAIDLService.setPowerKeyEnable(false,false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用POWER键成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setVolAddEnable:
                try {
//                    myAIDLService.setVolAddEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用音量+键成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setVolAddDisable:
                try {
//                    myAIDLService.setVolAddEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用音量+键成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setVolSubEnable:
                try {
//                    myAIDLService.setVolSubEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用音量-键成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setVolSubDisable:
                try {
//                    myAIDLService.setVolSubEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用音量-键成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.enableTp:
                try {
//                    myAIDLService.enableTp(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用TP成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.disAbleTp:
                try {
//                    myAIDLService.enableTp(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用TP成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.captureScreen:
                try {
                    Date currentTime = new Date();
                    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-ddHH-mm-ss");
                    String dateString = formatter.format(currentTime);
                    String path ="/sdcard/"+ dateString +".png";
//                    myAIDLService.captureScreen(path);

                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "截图成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setAdbEnable:
                try {
                    myAIDLService.setAdbEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用ADB成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setAdbDisable:
                try {
                    myAIDLService.setAdbEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用ADB成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.hideNotificationItems:
                try {
                    int intStr = Integer.parseInt(qsItem.getText().toString());
                    Log.d("lfy","hideNotificationItems......intStr="+intStr);
//                    myAIDLService.showNotificationItems(intStr,false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏下拉item成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.showNotificationItems:
                try {
                    int intStr = Integer.parseInt(qsItem.getText().toString());
                    Log.d("lfy","showNotificationItems......intStr="+intStr);
//                    myAIDLService.showNotificationItems(intStr,true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示下拉item成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setAirplaneDisable:
                try {
//                    myAIDLService.setAirplaneDisable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用飞行模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setAirplaneEnable:
                try {
//                    myAIDLService.setAirplaneDisable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用飞行模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setSettingOptionGoneorVisible:
                try {
                    int intStr = Integer.parseInt(editText.getText().toString());
                    Log.d("lfy","setSettingOptionGoneorVisible......intStr="+intStr);
//                    myAIDLService.setSettingOptionGoneorVisible(intStr,true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示设置下item成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setSettingOptionGoneorGone:
                try {
                    int intStr = Integer.parseInt(editText.getText().toString());
                    Log.d("lfy","setSettingOptionGoneorGone......intStr="+intStr);
//                    myAIDLService.setSettingOptionGoneorVisible(intStr,false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏设置下item成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.addToWifiBlacklist:
                try {
                    List<String> list = new ArrayList<>();
                    list.add(0,"KINGTOP_SW");
                    list.add(1,"KINGTOP_SW2");

//                    myAIDLService.addSSIDToBlackList(list);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "添加wifi黑名单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getToWifiBlacklist:
                try {
//                    List<String> list = myAIDLService.getSSIDBlackList();
//                    String str = "";
//                    for (String wifiStr:list) {
//                        str += wifiStr+";";
//                    }
//                    Log.d("lfy","getSSIDBlackList="+str);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "获取wifi黑名单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.removeAirplaneDisable:
                try {
                    List<String> list = new ArrayList<>();
                    list.add(0,"KINGTOP_SW");
                    list.add(1,"KINGTOP_SW2");
//                    myAIDLService.removeSSIDFromBlackList(list);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "wifi黑名中删除指定SSID单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.removeWifiBySsid:
                try {
//                    myAIDLService.removeWifiBySsid("KINGTOP_SW");
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "wifi中删除指定SSID单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setDefaultVideoPlayer:
                try {
//                    myAIDLService.setDefaultVideoPlayer("com.qiyi.video","org.iqiyi.video.activity.PlayerActivity");
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "设置默认播放器成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setReaderModeOpen:
                try {
//                    myAIDLService.setReaderModeClosed(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开阅读模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setReaderModeClosed:
                try {
//                    myAIDLService.setReaderModeClosed(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关闭阅读模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getReaderMode:
//                try {
//                    boolean flag = myAIDLService.getReaderMode();
//                    Log.d("lfy","阅读模式状态为："+(flag ? "打开" : "关闭"));
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取阅读模式状态成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setProtectEyeModeOpen:
                try {
//                    myAIDLService.setProtectEyeModeClosed(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开护眼模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setProtectEyeModeClosed:
                try {
//                    myAIDLService.setProtectEyeModeClosed(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关闭护眼模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getProtectEyeMode:
//                try {
//                    boolean flag = myAIDLService.getProtectEyeMode();
//                    Log.d("lfy","护眼模式状态为："+(flag ? "打开" : "关闭"));
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取护眼模式状态成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.turnOnGPS:
                try {
//                    myAIDLService.turnOnGPS(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开GPS成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.turnOffGPS:
                try {
//                    myAIDLService.turnOnGPS(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关闭GPS成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.isGPSTurnOn:
//                try {
//                    boolean flag = myAIDLService.isGPSTurnOn();
//                    Log.d("lfy","GPS状态为："+(flag ? "打开" : "关闭"));
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取GPS状态成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getSettingOptionHideOrVisibleState:
//                try {
//                    int intStr = Integer.parseInt(editText.getText().toString());
//                    Log.d("lfy","getSettingOptionHideOrVisibleState......intStr="+intStr);
//                    boolean flag = myAIDLService.getSettingOptionHideOrVisibleState(intStr);
//                    Log.d("lfy","输入的设置状态为："+(flag ? "显示" : "隐藏"));
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取设置状态成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getAdbState:
                try {
                    int aa = Settings.Secure.getInt(getApplicationContext().getContentResolver(), "private_dev_policy", 0);
                    Toast.makeText(MainActivity.this, "获取的值为："+aa, Toast.LENGTH_LONG).show();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                break;
            case R.id.setMtpEnable:
                try {
//                    myAIDLService.setMtpEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用MTP成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setMtpDisable:
                try {
//                    myAIDLService.setMtpEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用MTP成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setMobileDataOn:
                try {
//                    myAIDLService.setMobileDataOn(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开数据流量成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setMobileDataOff:
                try {
//                    myAIDLService.setMobileDataOn(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关闭数据流量成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getMobileDataState:
//                try {
//                    boolean flag = myAIDLService.getMobileDataState();
//                    Log.d("lfy","获取数据流量开关状态为："+(flag ? "打开" : "关闭"));
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取设置状态成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setBackLightBrightnessUp:
//                try {
//                    a += 10;
//                    myAIDLService.setBackLightBrightness(a);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "增加背光亮度成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setBackLightBrightnessDown:
//                try {
//                    a -= 10;
//                    myAIDLService.setBackLightBrightness(a);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "减少背光亮度成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.shutdownDevice:
                try {
//                    myAIDLService.shutdownDevice();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关机成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.rebootDevice:
                try {
//                    myAIDLService.rebootDevice();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "重启成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.wipeData:
                try {
//                    myAIDLService.wipeData();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "恢复出厂设置成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.hideBrightUp:
                try {
//                    myAIDLService.setScreenBrightnessAddVisible(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏亮度+成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.showBrightUp:
                try {
//                    myAIDLService.setScreenBrightnessAddVisible(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示亮度+成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.hideBrightDown:
                try {
//                    myAIDLService.setScreenBrightnessSubVisible(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏亮度-成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.showBrightDown:
                try {
//                    myAIDLService.setScreenBrightnessSubVisible(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示亮度-成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.hideVolUp:
                try {
//                    myAIDLService.setVolAddVisible(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏音量+成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.showVolUp:
                try {
//                    myAIDLService.setVolAddVisible(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示音量+成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.hideVolDown:
                try {
//                    myAIDLService.setVolSubVisible(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏音量-成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.showVolDown:
                try {
//                    myAIDLService.setVolSubVisible(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示音量-成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.hideScreenShot:
                try {
//                    myAIDLService.setScreenShotVisible(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏截图键成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.showScreenShot:
                try {
//                    myAIDLService.setScreenShotVisible(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "显示截图键成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setCameraEnable:
                try {
//                    myAIDLService.setCameraEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用Camera成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setCameraDisable:
                try {
//                    myAIDLService.setCameraEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用Camera成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setNotificationEnable:
                try {
//                    myAIDLService.setNotificationEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用通知成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setNotificationDisable:
                try {
//                    myAIDLService.setNotificationEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用通知成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.postNotification:
                try {
                    sendChatMsg(view);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "fa通知成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setVolumeMutedOpen:
                try {
//                    myAIDLService.setVolumeMuted(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开静音成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setVolumeMutedClose:
                try {
//                    myAIDLService.setVolumeMuted(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关闭静音成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setBluetoothOpen:
                try {
//                    myAIDLService.setBluetoothOpen(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开蓝牙成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setBluetoothClose:
                try {
//                    myAIDLService.setBluetoothOpen(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关闭蓝牙成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.momoInstall:
                try {
                    String path1 ="/sdcard/Auto.apk";
//                    myAIDLService.silentInstall(path1,true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "静默安装成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.silentUninstall:
                try {
//                    myAIDLService.silentUninstall("com.jingdong.app.mall");
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "静默卸载成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setDefaultLauncher:
                try {
                    //智能学习系统-launcher
                    ComponentName componentName = new ComponentName("com.jxw.launcher","com.jxw.launcher.ThemeActivity");
//                    myAIDLService.setDefaultLauncher(componentName);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "设置默认launcher成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.clearDefaultLauncher:
                try {
//                    myAIDLService.clearDefaultLauncher();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "清除launcher成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setDefaultBrowser:
                try {
//                    myAIDLService.setDefaultBrowser("com.UCMobile");
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "设置默认浏览器成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setAppRestriction:
                try {
                    EditText txBw = (EditText) findViewById(R.id.txtsetAppRestriction);
                    int mode = Integer.parseInt(txBw.getText().toString());
//                    myAIDLService.setAppRestriction(mode);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "设置应用安装黑白名单模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.addInstallWhite:
                try {
                    EditText txBw = (EditText) findViewById(R.id.txtsetAppRestriction);
                    int mode = Integer.parseInt(txBw.getText().toString());
                    EditText tx = (EditText) findViewById(R.id.txtaddInstallWhite);
                    String add = tx.getText().toString();
                    List<String> list = Arrays.asList(add.split(";"));
                    if (mode == 1){
//                        myAIDLService.addAppInstallBlackList(list);
                    }else {
//                        myAIDLService.addAppInstallWhiteList(list);
                    }
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "增加应用按装黑/白名单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.delInstallWhite:
                try {
                    EditText txBw = (EditText) findViewById(R.id.txtsetAppRestriction);
                    int mode = Integer.parseInt(txBw.getText().toString());
                    EditText tx = (EditText) findViewById(R.id.txtdelInstallWhite);
                    String add = tx.getText().toString();
                    List<String> list = Arrays.asList(add.split(";"));
                    if (mode == 1){
//                        myAIDLService.delAppInstallBlackList(list);
                    }else {
//                        myAIDLService.delAppInstallWhiteList(list);
                    }
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "删除应用安装白/黑名单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.noneInstallWhite:
                try {
                    EditText txBw = (EditText) findViewById(R.id.txtsetAppRestriction);
                    int mode = Integer.parseInt(txBw.getText().toString());
                    if (mode == 1){
//                        myAIDLService.clearAppInstallBlackList();
                    }else {
//                        myAIDLService.clearAppInstallWhiteList();
                    }
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "ClearAppInstallWhiteList", Toast.LENGTH_LONG).show();
                break;
            case R.id.getInstallWhite:
//                try {
//                    EditText txBw = (EditText) findViewById(R.id.txtsetAppRestriction);
//                    int mode = Integer.parseInt(txBw.getText().toString());
//                    List<String> list;
//                    if (mode == 1){
//                        list = myAIDLService.getAppInstallBlackList();
//                    }else {
//                        list = myAIDLService.getAppInstallWhiteList();
//                    }
//                    EditText tx = (EditText) findViewById(R.id.txtgetInstallWhite);
//                    tx.setText(list.toString());
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "读取黑/白名单列表成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.addunInstallBlack:
                try {
                    EditText tx = (EditText) findViewById(R.id.txtaddunInstallBlack);
                    String add = tx.getText().toString();
                    List<String> result = Arrays.asList(add.split(";"));
//                    myAIDLService.addAppUninstallBlackList(result);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "增加应用卸载黑名单成功", Toast.LENGTH_LONG).show();
                break;

            case R.id.delunInstallBlack:
                try {
                    EditText tx = (EditText) findViewById(R.id.txtdelunInstallBlack);
                    String add = tx.getText().toString();
                    List<String> result = Arrays.asList(add.split(";"));
//                    myAIDLService.delAppUninstallBlackList(result);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "删除的黑名单应用成功", Toast.LENGTH_LONG).show();
                break;

            case R.id.noneunInstallBlack:
                try {
//                    myAIDLService.clearAppUninstallBlackList();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "清空应用卸载黑名单成功", Toast.LENGTH_LONG).show();
                break;

            case R.id.getunInstallBlack:
//                try {
//                    Log.d("lfy","[MainActivity] getunInstallBlack......");
//                    List<String> list =  myAIDLService.getAppUnInstallBlackList();
//                    EditText tx = (EditText) findViewById(R.id.txtgetunInstallBlack);
//                    tx.setText(list.toString());
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取应用卸载黑名单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getAppRestrictionMode:
//                try {
//                    int mode =  myAIDLService.getAppRestrictionMode();
//                    String modeStr = "普通模式（黑白名单都不生效）";
//                    if (mode == 1){
//                        modeStr = "黑名单模式";
//                    }else if (mode == 2){
//                        modeStr = "白名单模式";
//                    }
//                    Log.d("lfy","获取应用安装名单模式为："+ modeStr);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取应用安装名单模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setappDisable:
//                try {
//                    //禁用指定应用的时候app图标会从桌面消失
//                    Log.d("lfy", "setappDisable......");
//                    List<String> stopList = new ArrayList<String>();
//                    stopList.add("com.jingdong.app.mall");
////                    stopList.add("com.UCMobile");
//                    myAIDLService.setAppEnable(false,stopList);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "禁用指定应用成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setappEnable:
                try {
                    //启用指定应用的时候桌面上消失的app图标会出现
                    List<String> stopList = new ArrayList<String>();
                    stopList.add("com.jingdong.app.mall");
//                    myAIDLService.setAppEnable(true,stopList);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用指定应用成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.clearAppDisable:
                try {
//                    myAIDLService.clearAppDisable();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "清空禁用应用成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getAppDisable:
//                try {
//                    EditText tx = (EditText) findViewById(R.id.txtgetStopApp);
//                    List<String> result=myAIDLService.getAppDisable();
//                    Log.d("lfy", "获取禁用列表为："+result );
//                    tx.setText(result.toString());
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取禁用列表成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getAppInfo:
//                try {
//                    List<String> list = myAIDLService.getThirdAppPkgList();
//                    Log.d("lfy","获取应用进程为："+list.toString());
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取当前所有正在运行的第三方应用进程接口", Toast.LENGTH_LONG).show();
                break;
            case R.id.getForbidenAppList:
//                try {
//                    List<String> list = myAIDLService.getForbidenAppList();
//                    String str = "";
//                    for (int i = 0; i < list.size(); i++){
//                        str += list.get(i);
//                    }
//                    Log.d("lfy","获取所有被禁用的apk列表："+str);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取当前所有正在运行的第三方应用进程接口", Toast.LENGTH_LONG).show();
                break;
            case R.id.killApp:
                try {
//                    myAIDLService.forceStopApp("com.jingdong.app.mall");
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "停止apk运行成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.entrySafeMode:
                try {
//                    myAIDLService.entrySafeMode();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "进入安全模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.entryRecoveryMode:
                try {
//                    myAIDLService.entryRecoveryMode();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "进入恢复模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.allowDrawOverlays:
                try {
//                    myAIDLService.allowDrawOverlays("com.jingdong.app.mall",true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开悬浮窗权限成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.disallowDrawOverlays:
                try {
//                    myAIDLService.allowDrawOverlays("com.jingdong.app.mall",false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关闭悬浮窗权限成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setBluetoothEnable:
                try {
//                    myAIDLService.setBluetoothEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用蓝牙成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setBluetoothDisable:
                try {
//                    myAIDLService.setBluetoothEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用蓝牙成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.turnOnAdb:
                try {
//                    myAIDLService.turnOnAdb(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开adb成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.turnOffAdb:
                try {
//                    myAIDLService.turnOnAdb(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关闭adb成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.turnOnMtp:
                try {
//                    myAIDLService.turnOnMtp(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开MTP数据传输成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.turnOffMtp:
                try {
//                    myAIDLService.turnOnMtp(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关闭MTP数据传输成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setWifiAdvanceEnable:
                try {
//                    myAIDLService.setWifiAdvanceEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用wifi成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setWifiAdvanceDisable:
                try {
//                    myAIDLService.setWifiAdvanceEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用wifi成功", Toast.LENGTH_LONG).show();
                break;
//            case R.id.allowAppModifySystemSettingsPermission:
//                try {
//                    myAIDLService.allowAppModifySystemSettingsPermission("com.jingdong.app.mall",true);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "开启修改设置权限成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.disallowAppModifySystemSettingsPermission:
//                try {
//                    myAIDLService.allowAppModifySystemSettingsPermission("com.jingdong.app.mall",false);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "关闭修改设置权限成功", Toast.LENGTH_LONG).show();
//                break;
            case R.id.allowGetUsageStats:
                try {
                    //一键锁屏-设备管理器测试apk，在设置-应用和通知-特殊应用权限-使用情况访问权限
                    Log.d("lfy","[MainActivity] allowGetUsageStats......");
//                    myAIDLService.allowGetUsageStats("com.master.onelockscreen",true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "打开使用情况访问权限成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.disallowGetUsageStats:
                try {
//                    myAIDLService.allowGetUsageStats("com.master.onelockscreen",false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "关闭使用情况访问权限成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setActiveAdmin:
                try {
//                    myAIDLService.setActiveAdmin("com.master.onelockscreen","com.master.onelockscreen.LockPermission");
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "设备管理器成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setSDOTGEnable:
                try {
//                    myAIDLService.setSDOTGEnable(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用OTG成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setSDOTGDisable:
                try {
//                    myAIDLService.setSDOTGEnable(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用OTG成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setFactoryResetDisabled:
                try {
//                    myAIDLService.setFactoryResetDisabled(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁止恢复出厂设置成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setFactoryResetEnable:
                try {
//                    myAIDLService.setFactoryResetDisabled(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "允许恢复出厂设置成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setAppPermission:
                try {
//                    myAIDLService.setAppPermission("com.jingdong.app.mall");
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "授予应用全部权限成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getPlayerList:
                try {
                    PackageManager packageManager = getApplicationContext().getPackageManager();
                    Intent intent = new Intent(Intent.ACTION_VIEW);
                    intent.setDataAndType(Uri.parse("file://"), "video/*");
                    intent.addCategory(Intent.CATEGORY_DEFAULT);

                    List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE);
                    int size = resolveInfoList.size();
                    android.util.Log.d("lfy","[FuncTools] setDefaultVideoPlayer...size="+size);
                    for (int i = 0; i < size; i++) {
                        ActivityInfo activityInfo = resolveInfoList.get(i).activityInfo;
                        android.util.Log.d("lfy","setDefaultVideoPlayer...packageName="+activityInfo.packageName+",className="+activityInfo.name+",i="+i);
                    }
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "授予应用全部权限成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setLockWallPaper:
                try {
                    String path ="/sdcard/1.jpg";
//                    myAIDLService.setLockWallPaper(path);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "设置锁屏壁纸成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setDefaultInputMethod:
                try {
//                    myAIDLService.setDefaultInputMethod("com.sohu.inputmethod.sogou/.SogouIME");
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "设置默认输入法成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setDeviceDate:
                try {
                    //linux命令：date -d "20190325 10:12:00" +%s  获取时间的long值
//                    long time = System.currentTimeMillis()/1000;
//                    myAIDLService.setDeviceDate(1553479920);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "设置系统时间成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getMac:
                try {
//                    String mac= myAIDLService.getMACaddress();
//                    android.util.Log.d("lfy","获取到MAC地址为："+mac);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "获取MAC地址成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.clearLockScreen:
                try {
//                    myAIDLService.clearLockScreen();
                    Log.d("lfy", "clearLockScreen......");
                } catch (Exception e) {
                    Log.d("lfy", e.toString());
                }
                Toast.makeText(MainActivity.this, "清除锁屏密码成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.lockNow:
                try {
//                    myAIDLService.lockNow(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "睡眠成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.isRooted:
//                try {
//                    boolean state = myAIDLService.isRooted();
//                    Log.d("lfy","Root状态为："+state);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取Root状态成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setScreenCaptureEnable:
                try {
//                    myAIDLService.setScreenCaptureDisabled(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用截图成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setScreenCaptureDisabled:
                try {
//                    myAIDLService.setScreenCaptureDisabled(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用截图成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setSafeModeEnable:
                try {
//                    myAIDLService.setSafeModeEnableState(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用安全模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setSafeModeDisabled:
                try {
//                    myAIDLService.setSafeModeEnableState(false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用安全模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getSafeModeEnableState:
//                try {
//                    boolean state = myAIDLService.getSafeModeEnableState();
//                    Log.d("lfy","获取安全模式启用/禁用状态为："+(state ? "启用" : "禁用"));
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "禁用安全模式成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.clearAppData:
                try {
//                    myAIDLService.clearAppData("com.jingdong.app.mall");
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "清除应用数据成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.clearRecentTask:
                try {
//                    myAIDLService.clearRecentTask();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "清除最近任务成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.hideActivity:
                try {
                    moveTaskToBack(true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "隐藏当前activity成功", Toast.LENGTH_LONG).show();
                break;
            // 上网白名单，黑名单
//            case R.id.getWebWhiteList:
//                try {
//                    List<String> result = myAIDLService.getWebWhiteList();
//                    Log.d("lfy","获取网址白名单为："+result.toString());
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取网址白名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.clearNetworkWhiteList:
//                try {
//                    myAIDLService.setNetworkWhiteList(null,0xff,false);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "清除网址白名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setNetworkWhiteList:
//                try {
//                    //url 正则表达式  .*iqiyi.com
//                    EditText tv =  (EditText)findViewById(R.id.txtsetNetworkWhiteList);
//                    Log.d("lfy","url="+tv.getText().toString());
//                    myAIDLService.setNetworkWhiteList(tv.getText().toString(),7,true);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "添加网址白名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.getWebBlackList:
//                try {
//                    List<String> result = myAIDLService.getWebBlackList();
//                    Log.d("lfy","获取网址黑名单为："+result.toString());
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取网址黑名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.clearNetworkBlackList:
//                try {
//                    myAIDLService.setNetworkBlackList(null,0xff,false);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "清除网址黑名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setNetworkBlackList:
//                try {
//                    EditText tv =  (EditText)findViewById(R.id.txtsetNetworkBlackList);
//                    myAIDLService.setNetworkBlackList(tv.getText().toString(),7,true);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "添加网址黑名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setAppWhite:
//                try {
//                    EditText tv =  (EditText)findViewById(R.id.txtsetNetworkWhiteList);
//                    List param = new ArrayList<String>();
//                    param.add(tv.getText().toString());
//                    myAIDLService.setAppNetWhiteList(tv.getText().toString(),7,true);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "设置app上网白名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setAppBlack:
//                try {
//                    EditText tv =  (EditText)findViewById(R.id.txtsetNetworkWhiteList);
//                    myAIDLService.setAppNetBlackList(tv.getText().toString(),7,true);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "设置app上网黑名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.getAppNetWhite:
//                try {
//                    List<String> pkgs=myAIDLService.getAppNetWhiteList();
//                    Log.d("lfy","获取app上网白名单为："+pkgs.toString());
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "getAppNetWhite", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.getAppNetBlack:
//                try {
//                    List<String> pkgs=myAIDLService.getAppNetBlackList();
//                    Log.d("lfy","获取app上网黑名单为："+pkgs.toString());
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "getAppNetWhite", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.clearAppBlackNet:
//                try {
//                    myAIDLService.setAppNetBlackList(null,7,false);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "清除app黑名单网络控制成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.clearAppWhiteNet:
//                try {
//                    myAIDLService.setAppNetWhiteList(null,7,false);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "清除app白名单网络控制成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setMmsSendDisabled:
//                try {
//                    myAIDLService.setMmsSendDisabled(true);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "禁用短信成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setMmsSendEnable:
//                try {
//                    myAIDLService.setMmsSendDisabled(false);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "启用短息成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setVoiceOutgoingDisable:
//                try {
//                    myAIDLService.setVoiceOutgoingDisable(true);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "禁用打电话成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setVoiceOutgoingEnable:
//                try {
//                    myAIDLService.setVoiceOutgoingDisable(false);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "启用打电话成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setVoiceIncomingDisabled:
//                try {
//                    myAIDLService.setVoiceIncomingDisabled(true);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "禁用接电话成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setVoiceIncomingEnable:
//                try {
//                    myAIDLService.setVoiceIncomingDisabled(false);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "启用接电话成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setEnableGlobalNetwork:
//                try {
//                    myAIDLService.setEnableGlobalNetwork(true);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "允许上网成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setDisableGlobalNetwork:
//                try {
//                    myAIDLService.setEnableGlobalNetwork(false);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "禁用上网成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.netBlackOpen:
//                try {
//                    myAIDLService.setNetRule(2);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "开启网络黑名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.netWhiteOpen:
//                try {
//                    myAIDLService.setNetRule(1);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "开启网络白名单成功", Toast.LENGTH_LONG).show();
//                break;
            case R.id.setPowerSaveWhiteList:
                try {
                    Log.d("lfy","setPowerSaveWhiteList......");
//                    myAIDLService.ignoringBatteryOptimizations("com.jingdong.app.mall",true);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "设置电量优化白名单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.removePowerSaveWhiteList:
                try {
//                    myAIDLService.ignoringBatteryOptimizations("com.jingdong.app.mall",false);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "取消电量优化白名单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getUserPowerWhitelist:
//                try {
//                    List<String> list = myAIDLService.getUnOptimizePowerList();
//                    String whiteList = "";
//                    if (list.size()>0){
//                        for (String str : list){
//                            whiteList += (str+";");
//                        }
//                    }
//                    Log.d("lfy","获取电量优化白名单："+whiteList);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取电量优化白名单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.onCut:
                ScreenShot.shoot(this);
                Toast.makeText(MainActivity.this, "获取电量优化白名单成功", Toast.LENGTH_LONG).show();
                break;
//            case R.id.setContactsBlackRestriction:
//                try {
//                    myAIDLService.setContactsRestriction(1);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "开启联系人黑名单规则成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.addMdmBlackNumberList:
//                try {
//                    List<String> list = new ArrayList<>();
//                    list.add(0,"18589025806");
//                    myAIDLService.addMdmNumberList(1,list,0,0);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "设置联系人黑名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.removeAllMdmBlackNumber:
//                try {
//                    List<String> list = new ArrayList<>();
//                    list.add(0,"18576759258");
//                    myAIDLService.removeMdmNumberList(1,list,1,1);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "设置联系人黑名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setBootupAlert:
//                try {
//                    int[] mDaysOfWeek = {1,1,1,1,1,0,1};
//                    myAIDLService.setBootupAlert(false,4,30,mDaysOfWeek,0);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "设置定时开机成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.setShutdownAlert:
//                try {
//                    int[] mDaysOfWeek = {1,0,1,1,1,1,1};
//                    myAIDLService.setShutdownAlert(false,17,20,mDaysOfWeek,0);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "设置定时关机成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.enableNotificationPackages:
//                try {
//                    List<String> list = new ArrayList<>();
//                    list.add(0,"com.example.studyapplication");
//                    list.add(1,"com.example.testtenproject");
//                    myAIDLService.enableNotificationPackages(list);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "设置通知白名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.getDEnableNotificationPackages:
//                try {
//                    List<String> list = myAIDLService.getDEnableNotificationPackages();
//                    String pkgStr = "";
//                    if (list.size()>0){
//                        for (String pkg:list) {
//                            pkgStr += (pkg+";");
//                        }
//                    }
//                    Log.d("lfy","getDEnableNotificationPackages...="+pkgStr);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取通知白名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.disableNotificationPackages:
//                try {
//                    List<String> list = new ArrayList<>();
//                    list.add(0,"com.example.studyapplication");
//                    list.add(1,"com.example.testtenproject");
//                    myAIDLService.disableNotificationPackages(list);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "设置通知黑名单成功", Toast.LENGTH_LONG).show();
//                break;
//            case R.id.getDisableNotificationPackages:
//                try {
//                    List<String> list = myAIDLService.getDisableNotificationPackages();
//                    String pkgStr = "";
//                    if (list.size()>0){
//                        for (String pkg:list) {
//                            pkgStr += (pkg+";");
//                        }
//                    }
//                    Log.d("lfy","getDisableNotificationPackages...="+pkgStr);
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "获取通知黑名单成功", Toast.LENGTH_LONG).show();
//                break;
            case R.id.getOtgState:
                UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE);
                boolean flag = userManager.hasUserRestriction(UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA);
                android.util.Log.d("lfy","otg状态为："+(flag ? "禁用" : "启用"));
                break;
            case R.id.getWifitState:
                UserManager userManager1 = (UserManager) getSystemService(Context.USER_SERVICE);
                boolean flag1 = userManager1.hasUserRestriction(UserManager.DISALLOW_CONFIG_WIFI);
                android.util.Log.d("lfy","wif状态为： "+(flag1 ? "禁用" : "启用"));
                break;
            case R.id.addSSIDToWhiteList:
//                try {
//                    List<String> list = new ArrayList<>();
//                    list.add(0,"KINGTOP_SW2");
//                    myAIDLService.addSSIDToWhiteList(list);
//                }catch (Exception e){
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "添加wifi到白名单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.removeSSIDFromWhiteList:
                try {
                    List<String> list = new ArrayList<>();
                    list.add(0,"KINGTOP_SW2");
//                    myAIDLService.removeSSIDFromWhiteList(list);
                }catch (Exception e){
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "删除wifi从白名单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.getSSIDWhiteList:
//                try {
//                    List<String> list = myAIDLService.getSSIDWhiteList();
//                    String whiteList = "";
//                    if (list.size()>0){
//                        for (String str : list){
//                            whiteList += (str+";");
//                        }
//                    }
//                    Log.d("lfy","getSSIDWhiteList="+whiteList);
//                }catch (Exception e){
//                    Log.d(TAG, e.toString());
//                }
//                Toast.makeText(MainActivity.this, "删除wifi从白名单成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setClipBoardEnable:
                try {
//                    myAIDLService.setClipBoardDisable(false);
                }catch (Exception e){
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "启用剪切板成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setClipBoardDisable:
                try {
//                    myAIDLService.setClipBoardDisable(true);
                }catch (Exception e){
                    Log.d(TAG, e.toString());
                }
                Toast.makeText(MainActivity.this, "禁用剪切板成功", Toast.LENGTH_LONG).show();
                break;
            case R.id.setRotationLand:
                try {
//                    myAIDLService.setFocusRotation(1);
                    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                break;
            case R.id.setRotationPor:
                try {
//                    myAIDLService.setFocusRotation(2);
                    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                break;
            case R.id.setRotation:
                try {
//                    myAIDLService.setFocusRotation(0);
                    Log.d("lfy","MainActivity rotation = "+getRequestedOrientation());
                    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                break;
            case R.id.setLockScreenNotificationVisible:
                try {
//                    myAIDLService.setLockScreenNotificationVisible(true);
                    Toast.makeText(MainActivity.this, "清除锁屏界面通知成功", Toast.LENGTH_LONG).show();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                break;
            case R.id.setLockScreenNotificationUnVisible:
                try {
//                    myAIDLService.setLockScreenNotificationVisible(false);
                    Toast.makeText(MainActivity.this, "显示锁屏界面通知成功", Toast.LENGTH_LONG).show();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                break;
            case R.id.setDecorCaptionViewShow:
                try {
                    KeyEvent dsad;
//                    myAIDLService.setDecorCaptionViewShow(1);
                    Toast.makeText(MainActivity.this, "显示DecorCaptionView成功", Toast.LENGTH_LONG).show();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                break;
            case R.id.setDecorCaptionViewGone:
                try {
//                    myAIDLService.setDecorCaptionViewShow(0);
                    Toast.makeText(MainActivity.this, "隐藏DecorCaptionView成功", Toast.LENGTH_LONG).show();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                break;
            case R.id.jump:
                try {
                    //ComponentName cmp = new ComponentName("com.android.dialer.main.impl","com.android.dialer.main.impl.MainActivity");
                    //Intent intent = new Intent();
                    Intent dialIntent =  new Intent(Intent.ACTION_CALL_BUTTON);
                    dialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    android.util.Log.d("lfy","[jump]..........");
                    //intent.setComponent(cmp);
                    getApplicationContext().startActivity(dialIntent);
                    Toast.makeText(MainActivity.this, "跳转到拨号界面成功", Toast.LENGTH_LONG).show();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                break;
            case R.id.showIcon:
//                try {
                    ComponentName cmp = new ComponentName("com.google.android.dialer","com.google.android.dialer.extensions.GoogleDialtactsActivity");

//                    PackageManager packageManager = getPackageManager();
//                    int res = packageManager.getComponentEnabledSetting(cmp);
//                    // 显示应用图标
//                    packageManager.setComponentEnabledSetting(cmp, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
//                            PackageManager.DONT_KILL_APP);
//                    Toast.makeText(MainActivity.this, "跳转到拨号界面成功", Toast.LENGTH_LONG).show();
//                } catch (Exception e) {
//                    Log.d(TAG, e.toString());
//                }
                break;
            case R.id.hideIcon:
                try {
//                    ComponentName cmp = new ComponentName("com.google.android.dialer","com.google.android.dialer.extensions.GoogleDialtactsActivity");
//                    PackageManager packageManager = getPackageManager();
//                    int res = packageManager.getComponentEnabledSetting(cmp);
//                    if (res == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
//                            || res == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
//                        // 隐藏应用图标
//                        packageManager.setComponentEnabledSetting(cmp, PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
//                                PackageManager.DONT_KILL_APP);
//                    }
                    Toast.makeText(MainActivity.this, "跳转到拨号界面成功", Toast.LENGTH_LONG).show();
                } catch (Exception e) {
                    Log.d(TAG, e.toString());
                }
                break;
        }
    }

    private void sendChatMsg(View view) {
        NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        Notification notification = new NotificationCompat.Builder(this, "chat")
                .setContentTitle("收到一条聊天消息")
                .setContentText("今天中午吃什么？")
                .setWhen(System.currentTimeMillis())
                .setSmallIcon(R.drawable.ic_launcher_background)
                .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
                .setAutoCancel(true)
                .setNumber(2)
                .build();
        manager.notify(1, notification);
    }

    public Bitmap onCut(Activity activity){
        //获取window最底层的view
        View view=activity.getWindow().getDecorView();
        view.buildDrawingCache();

        //状态栏高度
        Rect rect=new Rect();
        view.getWindowVisibleDisplayFrame(rect);
        int stateBarHeight=rect.top;
        Display display=activity.getWindowManager().getDefaultDisplay();

        //获取屏幕宽高
        int widths=display.getWidth();
        int height=display.getHeight();

        //设置允许当前窗口保存缓存信息
        view.setDrawingCacheEnabled(true);

        //去掉状态栏高度
        Bitmap bitmap=Bitmap.createBitmap(view.getDrawingCache(),0,stateBarHeight,widths,height-stateBarHeight);

        view.destroyDrawingCache();
        return bitmap;
    }

}
